<template>
    <div id="login">
		<img class="logo" src="../assets/logo.png" alt="">
  <div class="mid_box">
    <div class="mid_left_box">

    </div>
    <div class="mid_right_box">
      <div class="title" >用户注册</div>

      <div class="control">

        		<form>		<!-- 表单向servlet传登录信息 -->	
					<div class="dom" style="display: block;">
						<form action="" >
							<div id="s1">
								<h>账号:</h>
								<input id="input" type="text" v-model="phone" name="phone" placeholder="手机号">
							</div>
                            <div id="s1">
								<h>密码:</h>
								<input id="input" 
								   v-model="password"
                   					 type="password"
                    				name="password" 
									placeholder="密码">
							</div>
							
							
							<el-button  type="primary" @click="zhuce()">注册</el-button>
						</form>
						
						<div class="zhuce">
							<a href="../views/login.vue">返回登录</a>
						</div>
					</div>
        </form>

    </div>
    </div>

    </div>
  </div>
</template>
<script>
import axios from "axios";
import qs from "qs";
export default {
	data(){
		return{
			
			phone:1,
			password:1,
			

		}
	},
	methods:{
		zhuce(){
			let data = qs.stringify({
        	user_phone: this.phone,
        	user_password: this.password,
			
      });
      // console.log(data);
      axios.post("api/Users/register.do", data).then((res) => {
		
        if (res.data != '') {
			alert("注册成功！");
		  this.$router.push("./login");
        } else {
			alert("请重新登录！")
          this.$router.push("./register");
          
        }
      });


		}
	}
}
</script>
<style scoped>
@import "/src/assets/css/login.css";
.el-button--primary {
    color: #FFF;
    background-color: #e30001;
    border-color: #e30001;
    border-radius: 10px;}

</style>